package com.zzl.finance.data.feign;

import com.zzl.apidoc.annotation.ApidocOperation;
import com.zzl.apidoc.annotation.ApidocParam;
import com.zzl.finance.data.dto.feign.ApproveLogAddDto;
import com.zzl.finance.data.dto.feign.ApproveLogEntity;
import com.zzl.finance.data.entity.feign.SupplierCreditEntity;
import com.zzl.finance.data.entity.feign.TicketEntity;
import com.zzl.general.common.apidoc.annotation.ApidocReturnPage;
import com.zzl.general.common.apidoc.annotation.ApidocReturnR;
import com.zzl.general.common.feign.config.FeignClientsConfig;
import com.zzl.general.common.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * 调用 bondsticket 服务 feign 方法
 *
 * @author : spp
 * @date : 2021/12/1 09:22
 */
@FeignClient(value = "bondsticket", configuration = FeignClientsConfig.class)
public interface BondsTicketFeign {

    /**
     * 获取 企业的授信总额度 以及在各个银行的额度
     *
     * @param enterpriseIds 企业id 集合
     * @return 企业授信额度
     */
    @PostMapping("bondsticket/feign/getEnterpriseQuota")
    Map<String, List<SupplierCreditEntity>> getEnterpriseQuota(@RequestBody List<String> enterpriseIds);

    @GetMapping("bondsticket/feign/getInstitutyCredit")
    Map<Integer, Double> getInstitutyCredit();

    /**
     * 我的票据信息
     *
     * @param id 票据id
     * @return 票据对象
     */
    @GetMapping("/bondsticket/info/{id}")
    TicketEntity ticketInfo(@ApidocParam(name = "我的票据id", required = true) @PathVariable("id") Integer id);

    /**
     * 融资额度列表 查询，融资申请时展示使用
     */
    @GetMapping("/bondsticket/feign/getFinanceCreditList/{enterpriseId}")
    @ApidocOperation(description = "查询融资额度列表", operationId = "list/1/1/2")
    List<SupplierCreditEntity> getFinanceList(@PathVariable("enterpriseId") String enterpriseId);

    /**
     * 获取该票的可转单企业id
     */
    @GetMapping("/bondsticket/feign/getAcquirerDropDownList/{ticketId}")
    List<String> getAcquirerDropDownList(@PathVariable("ticketId") String ticketId);


    /**
     * 保存
     */
    @PostMapping("bondsticket/feign/approveLogSave")
    @ApidocReturnR
    Result approveLogSave(@ApidocParam(description = "保存的审核记录对象值", name = "approveLog", required = true) @RequestBody ApproveLogAddDto approveLog);

    /**
     * 列表
     */
    @GetMapping("bondsticket/feign/list/{businessId}")
    List<ApproveLogEntity> list(@ApidocParam(description = "审核记录id", name = "id", required = true) @PathVariable("businessId") String businessId);
}
